The camera looks distance pixels ahead of the way the followed target is moving, and swings to the other side speed pixels a frame when the target turns round (0 or less: at once). A distance of 0 (the default) is no look-ahead.
Sega Genesis: not built yet
On other consoles this differs: see Side by side and How the consoles differ.
camera_look_ahead(distance, speed)| Name | Type |
|---|---|
distance | real |
speed | real |
Nothing.
Makes the followed camera look ahead: it centers itself distance pixels in front of the way the target is moving, so the player sees more of where they are going than of where they have been.
When the target turns round, the camera does not snap to the other side. It swings across at speed pixels a frame. A speed of 0 or less swings at once, and a speed below 1 counts as 1. While the target stands still the camera keeps looking the way it last moved, so the picture does not creep back to the middle every time the player stops.
Across and down are separate: a player walking left and down at once makes the camera look ahead to the left and down. A distance of 0 (the default) is no look-ahead at all.
It leads the camera by whole pixels, the same way the rest of the camera works, so a moving sprite never shimmers. The setting stays until you change it. A jump of more than 24 pixels in one frame (a teleport) says nothing about which way the target is walking, so it does not turn the camera.
Room Properties and World Properties have the same setting in their Camera section. It is applied when the room starts, before any of your code runs, so a call to this function always has the last word.
camera_look_ahead(32, 4);The camera looks 32 pixels in front of the way the target moves, and takes 8 frames to swing from one side to the other.
Whole pixels: a speed below 1 counts as 1. A project-wide setting; a call in code always overrides what the Camera section of Room Properties set.